﻿using SqlSugar;
using Zhp.SqlSugar.Entity;

namespace Zhp.Entity.Design
{
    /// <summary>
    /// 动态列表
    /// </summary>
    [SugarTable("Design_List")]
    public class DesignList : BaseEntity<long>
    {
        /// <summary>
        /// 列表名称
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "列表名称")]
        public string Name { get; set; }

        /// <summary>
        /// 表单ID
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "表单ID")]
        public long? FormId { get; set; }

        /// <summary>
        /// 表单名称
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "表单名称")]
        public string FormName { get; set; }

        /// <summary>
        /// 表格配置
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(max)", ColumnDescription = "表格配置")]
        public string TableConfig { get; set; }

        /// <summary>
        /// 列表配置
        /// </summary>
        [SugarColumn(IsNullable = true, IsJson = true, ColumnDescription = "列表配置")]
        public DesignListConfig ListConfig { get; set; }

        /// <summary>
        /// 菜单ID
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "菜单ID")]
        public long MenuId { get; set; }

        /// <summary>
        /// 菜单配置
        /// </summary>
        [SugarColumn(IsNullable = true, IsJson = true, ColumnDescription = "菜单配置")]
        public DesignListMenuConfig MenuConfig { get; set; }
    }

    /// <summary>
    /// 菜单配置
    /// </summary>
    public class DesignListMenuConfig
    {
        /// <summary>
        /// 父级菜单
        /// </summary>
        public long? ParentId { get; set; }
        /// <summary>
        /// 菜单排序
        /// </summary>
        public int Order { get; set; }
    }

    /// <summary>
    /// 列表配置
    /// </summary>
    public class DesignListConfig
    {
        /// <summary>
        /// 默认排序字段
        /// </summary>
        public string DefaultOrder { get; set; }
        /// <summary>
        /// 默认排序方式
        /// </summary>
        public string DefaultOrderBy { get; set; }
    }
}
